package com.dreamcode.caloriestracker.utils;

class MathConvert{

    public MathConvert()
    {
    }

    public static double ConvertInchesToCMs(double d)
    {
        return d * 2.54D;
    }

    public static double ConvertInchesToMeters(double d)
    {
        return d * 0.025400000000000002D;
    }

    public static double ConvertKgsToLbs(double d)
    {
        return d * 2.2000000000000002D;
    }

    public static double ConvertLbsToKgs(double d)
    {
        return d / 2.2000000000000002D;
    }

    public static double ConvertMetersToInches(double d)
    {
        return d / 0.025400000000000002D;
    }

    public static double ConvertMphToKph(double d)
    {
        return d / 0.60000000000000009D;
    }

    public static double Round(double d, double d1)
    {
        double d2 = (double)(int)((d + d1 / 2D) / d1) * d1;
        return d2;
    }

    public static String doubleToString(double d, int i)
    {
        String s = String.valueOf(d);
        int j = s.indexOf(".");
        if(j < 0)
        {
            s = s + ".";
            j = s.indexOf(".");
        }
        for(; s.length() - j - 1 < i; s = s + "0");
        if(i > 0)
            i++;
        s = s.substring(0, j + i);
        return s;
    }

    public static double stringToDouble(String s)
    {
        Double double1;
        try
        {
            double1 = new Double(s);
        }
        catch(Exception _ex)
        {
            double1 = new Double(0.0D);
        }
        return double1.doubleValue();
    }
}